<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/resources/layout/templateInterno.xhtml"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:t="http://myfaces.apache.org/tomahawk"
    xmlns:rich="http://richfaces.org/rich">
	<ui:define name="body">
	
	
		
		<h:form style="margin-left:100px"  id="formMembroPesquisa" styleClass="form">
		<h:panelGroup id="pgMensagens">
			  <div align="center">
					<h:messages  errorClass="form-msg-error" infoClass="form-msg-success" />
			</div>
		</h:panelGroup>
		
		 <t:fieldset id="idfsDadosPessoais" styleClass="panel" legend="Filtros">
			<a4j:region id="filtroPesquisa">
					 <div class="grid-2-12">
					<h:outputLabel class="form-lbl"  value="Matrículaa:"/>				
					<h:inputText styleClass="form-txt" maxlength="9" value="#{membroCadastro.membroPesquisa.matricula}" id="matriculaPesquisa" >
					 	<rich:jQuery selector="#matriculaPesquisa" query="numeric()" timing="onload"/>
					</h:inputText>
				 </div>	
				  <div class="grid-6-12">
					<h:outputLabel class="form-lbl"  value="Nome:"/>				
					<h:inputText styleClass="form-txt"  value="#{membroCadastro.membroPesquisa.nome}" id="nomePesquisa" />
				 </div>
				<div class="grid-4-12">
					<h:outputLabel id="lbDataNascimento" class="form-lbl" value="Dat. Nascimento:" />
					 <rich:calendar id="clDataNascimento" 
					 				firstWeekDay="0" 
					 				minDaysInFirstWeek="2" 
					 				value="#{membroCadastro.membroPesquisa.dtNascimento}"
									datePattern="dd/MM/yyyy" inputSize="10" inputClass="maskDate" enableManualInput="true" disabled="false">
					</rich:calendar> 
					<rich:jQuery id="mskDataNascimento" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" />
				</div>
				
				 <div class="field-clear"></div>
			</a4j:region>
		</t:fieldset>
			<div style="padding-bottom: 20px; padding-top: 20px">
				 <div class="grid-2-12">
					<a4j:commandButton id="cbPesquisar"  styleClass="form-button" action="#{membroCadastro.pesquisar}" reRender="pgMensagens,membroPesquisaTable,idfsDadosPessoais" value="Pesquisar" >
					
					</a4j:commandButton>
				</div>
			</div>
			<div class="field-clear"></div>
			<div style="padding: 20px" >
			 	<rich:dataTable  
                    			
                    			width="750" border="0" id="membroPesquisaTable" styleClass="dataTable rich-table rich-table-cell ui-widget-content ui-grid-content"  var="membro" value="#{membroCadastro.listaMembros}" >
				  <f:facet  name="header">
                    <rich:columnGroup >
                            <rich:column style="text-align: center; width:15px"  styleClass="ui-state-default" >
                                <strong><h:outputText value="MATRÍCULA" /></strong>
                            </rich:column>
                            <rich:column style="text-align: center"  styleClass="ui-state-default" >
                                <strong><h:outputText value="NOME" /></strong>
                            </rich:column>
                            <rich:column style="text-align: center; width:200px"  styleClass="ui-state-default" >
                                <strong><h:outputText value="IGREJA" /></strong>
                            </rich:column>
                            
                    	</rich:columnGroup>
                  </f:facet>
 				<rich:columnGroup >	
 					<rich:column style="text-align:center" >
 					<h:commandLink id="editar" value="#{membro.coSeqMembro}" action="#{membroCadastro.redirectMembro}" >
							<f:param id="coMembro" name="coMembro" value="#{membro.coSeqMembro}" ></f:param>
							 <f:setPropertyActionListener target="#{membroCadastro.membro}" value="#{membro}"/>  
						</h:commandLink>
					</rich:column>		
					 <rich:column style="text-align:center">
						<h:outputText value="#{membro.nome}" />
					</rich:column>
					<rich:column style="text-align:center">
						<h:outputText value="#{membro.igrejaPertence.nome}" />
					</rich:column>
					
				</rich:columnGroup>
			</rich:dataTable>
		</div>
		</h:form>
			<t:saveState id="membroVo" value="#{membroCadastro.coMembro}"/> 
			<t:saveState value="#{membroCadastro.membroPesquisa}"/>
	</ui:define>
</ui:composition>
